import { createRouter, createWebHistory } from "vue-router";
import layout from "../views/layout/index.vue";
import login from "../views/login/index.vue";
import register from "../views/register/index.vue";
import product from "../views/product/index.vue";
import productManagement from "../views/admin/productManagement.vue";
import cart from "../views/admin/Cart.vue";
import OrderList from "../views/admin/OrderList.vue";
import OrderDetail from "../views/admin/OrderDetail.vue";
const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: "/",
      component: layout,
      redirect: "/login",
      children: [
        { path: "product", component: product },
        { path: "admin/productManagement", component: productManagement },
        { path: "admin/Cart", component: cart },
        { path: "admin/Order",component: OrderList},
        {path: "admin/Order/:orderId",component: OrderDetail}
      ],
    },
    { path: "/login", name: "login", component: login },
    { path: "/register", component: register },
  ],
});

export default router;